<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Linux," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;在linux下面安装一个源码包是最常用的，在日常的管理工作中，大部分软件都是通过源码安装的。安装一个源码包，是需要自己把源代码编译成二进制的可执行文件。如果读得懂这些源代码，那么就可以去修改这些源代码自定义功能，然后再去编译成想要的。使用源码包的好处除了可以自定义修改源代码外还可以定制相关的功能，因为源">
<meta name="keywords" content="Linux">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux源码包安装">
<meta property="og:url" content="https://hcldirgit.github.io/2017/09/03/1. Linux 基础/40.Linux源码包安装/index.html">
<meta property="og:site_name" content="失落的乐章">
<meta property="og:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;在linux下面安装一个源码包是最常用的，在日常的管理工作中，大部分软件都是通过源码安装的。安装一个源码包，是需要自己把源代码编译成二进制的可执行文件。如果读得懂这些源代码，那么就可以去修改这些源代码自定义功能，然后再去编译成想要的。使用源码包的好处除了可以自定义修改源代码外还可以定制相关的功能，因为源">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-09-01T08:29:17.469Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Linux源码包安装">
<meta name="twitter:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;在linux下面安装一个源码包是最常用的，在日常的管理工作中，大部分软件都是通过源码安装的。安装一个源码包，是需要自己把源代码编译成二进制的可执行文件。如果读得懂这些源代码，那么就可以去修改这些源代码自定义功能，然后再去编译成想要的。使用源码包的好处除了可以自定义修改源代码外还可以定制相关的功能，因为源">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://hcldirgit.github.io/2017/09/03/1. Linux 基础/40.Linux源码包安装/"/>





  <title>Linux源码包安装 | 失落的乐章</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', '85*****1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?87980c**************99ec5e26fb5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>











  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">失落的乐章</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术面前，永远都是学生。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-message">
          <a href="/message" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-external-link"></i> <br />
            
            留言
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://hcldirgit.github.io/2017/09/03/1. Linux 基础/40.Linux源码包安装/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="失落的乐章">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/0.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="失落的乐章">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Linux源码包安装</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-03T01:55:11+08:00">
                2017-09-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在linux下面安装一个源码包是最常用的，在日常的管理工作中，大部分软件都是通过源码安装的。安装一个源码包，是需要自己把源代码编译成二进制的可执行文件。如果读得懂这些源代码，那么就可以去修改这些源代码自定义功能，然后再去编译成想要的。使用源码包的好处除了可以自定义修改源代码外还可以定制相关的功能，因为源码包在编译的时候是可以附加额外的选项的。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;源码包的编译用到了linux系统里的编译器，常见的源码包一般都是用C语言开发的，这也是因为C语言为linux上最标准的程序语言。Linux上的C语言编译器叫做gcc，利用它就可以把C语言变成可执行的二进制文件。所以如果你的机器上没有安装gcc就没有办法去编译源码。你可以使用 yum install -y gcc 来完成安装。</p>
<h2 id="安装一个源码包，通常需要三个步骤："><a href="#安装一个源码包，通常需要三个步骤：" class="headerlink" title="安装一个源码包，通常需要三个步骤："></a>安装一个源码包，通常需要三个步骤：</h2><h3 id="configure"><a href="#configure" class="headerlink" title="./configure"></a>./configure</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在这一步可以定制功能，加上相应的选项即可，具有有什么选项可以通过 ./configure –help 命令来查看。在这一步会自动检测你的linux系统与相关的套件是否有编译该源码包时需要的库，因为一旦缺少某个库就不能完成编译。只有检测通过后才会生成一个Makefile文件。</p>
<h3 id="make"><a href="#make" class="headerlink" title="make"></a>make</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;使用这个命令会根据Makefile文件中预设的参数进行编译，这一步其实就是gcc在工作了。</p>
<h3 id="make-install"><a href="#make-install" class="headerlink" title="make install"></a>make install</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;安装步骤，生成相关的软件存放目录和配置文件的过程。</p>
<h2 id="Apache源码安装实例"><a href="#Apache源码安装实例" class="headerlink" title="Apache源码安装实例"></a>Apache源码安装实例</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;上面的3步并不是所有的源码包软件都一样的，也就是说源码包的安装并非具有一定的标准安装步骤。这就需要拿到源码包解压后，然后进入到目录找相关的帮助文档，通常会以INSTALL或者README为文件名。所以一定要去看一下。</p>
<h3 id="1-下载一个源码包"><a href="#1-下载一个源码包" class="headerlink" title="1.下载一个源码包"></a>1.下载一个源码包</h3><p>下载源码包一定要去官方站点去下载，不要在网上随便下载，那样很不安全。因为下载到的源码包很有可能是被人修改过的。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost src]<span class="comment"># cd /usr/local/src/</span></div><div class="line">[root@localhost src]<span class="comment"># wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.27.tar.bz2</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;下载地址为apache官方网站上提供的一个镜像，下载速度还可以。在下载之前，进入到了 “/usr/local/src” 目录，这是因为习惯把源码包都放到这个目录下，这样做的好处是，方便自己和其他管理员维护，所以以后下载的源码包都统一放到这个目录下吧。</p>
<h3 id="2-解压源码包"><a href="#2-解压源码包" class="headerlink" title="2.解压源码包"></a>2.解压源码包</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost src]<span class="comment"># tar jxvf httpd-2.2.27.tar.bz2</span></div></pre></td></tr></table></figure>
<h3 id="3-配置相关的选项，并生成Makefile"><a href="#3-配置相关的选项，并生成Makefile" class="headerlink" title="3.配置相关的选项，并生成Makefile"></a>3.配置相关的选项，并生成Makefile</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div></pre></td><td class="code"><pre><div class="line">[root@localhost src]<span class="comment"># cd httpd-2.2.27</span></div><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># ./configure --help |less</span></div><div class="line">`configure<span class="string">' configures this package to adapt to many kinds of systems.</span></div><div class="line"><span class="string"></span></div><div class="line"><span class="string">Usage: ./configure [OPTION]... [VAR=VALUE]...</span></div><div class="line"><span class="string"></span></div><div class="line"><span class="string">To assign environment variables (e.g., CC, CFLAGS...), specify them as</span></div><div class="line"><span class="string">VAR=VALUE.  See below for descriptions of some of the useful variables.</span></div><div class="line"><span class="string"></span></div><div class="line"><span class="string">Defaults for the options are specified in brackets.</span></div><div class="line"><span class="string"></span></div><div class="line"><span class="string">Configuration:</span></div><div class="line"><span class="string">  -h, --help              display this help and exit</span></div><div class="line"><span class="string">      --help=short        display options specific to this package</span></div><div class="line"><span class="string">      --help=recursive    display the short help of all the included packages</span></div><div class="line"><span class="string">  -V, --version           display version information and exit</span></div><div class="line"><span class="string">  -q, --quiet, --silent   do not print `checking ...'</span> messages</div><div class="line">      --cache-file=FILE   cache <span class="built_in">test</span> results <span class="keyword">in</span> FILE [disabled]</div><div class="line">  -C, --config-cache      <span class="built_in">alias</span> <span class="keyword">for</span> `--cache-file=config.cache<span class="string">'</span></div><div class="line"><span class="string">  -n, --no-create         do not create output files</span></div><div class="line"><span class="string">      --srcdir=DIR        find the sources in DIR [configure dir or `..'</span>]</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;使用 ./configure –help 命令查看可以使用的选项。一般常用的有 –prefix=PREFIX 这个选项的意思是定义软件包安装到哪里。一个小小的建议，通常源码包都是安装在/usr/local/目录下的。比如，把apache安装在/usr/local/apache2下，那么这里就应该这样写 –prefix=/usr/local/apache2 其他还有好多选项，如果有耐心可以挨个去看一看都有什么作用。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># ./configure --prefix=/usr/local/apache2</span></div><div class="line">checking <span class="keyword">for</span> chosen layout... Apache</div><div class="line">checking <span class="keyword">for</span> working mkdir -p... yes</div><div class="line">checking build system <span class="built_in">type</span>... i686-pc-linux-gnu</div><div class="line">checking host system <span class="built_in">type</span>... i686-pc-linux-gnu</div><div class="line">checking target system <span class="built_in">type</span>... i686-pc-linux-gnu</div><div class="line"></div><div class="line">Configuring Apache Portable Runtime library ...</div><div class="line"></div><div class="line">checking <span class="keyword">for</span> APR... reconfig</div><div class="line">configuring package <span class="keyword">in</span> srclib/apr now</div><div class="line">checking build system <span class="built_in">type</span>... i686-pc-linux-gnu</div><div class="line">checking host system <span class="built_in">type</span>... i686-pc-linux-gnu</div><div class="line">checking target system <span class="built_in">type</span>... i686-pc-linux-gnu</div><div class="line">Configuring APR library</div><div class="line">Platform: i686-pc-linux-gnu</div><div class="line">checking <span class="keyword">for</span> working mkdir -p... yes</div><div class="line">APR Version: 1.4.6</div><div class="line">checking <span class="keyword">for</span> chosen layout... apr</div><div class="line">checking <span class="keyword">for</span> gcc... no</div><div class="line">checking <span class="keyword">for</span> cc... no</div><div class="line">checking <span class="keyword">for</span> cl.exe... no</div><div class="line">configure: error: <span class="keyword">in</span> `/usr/<span class="built_in">local</span>/src/httpd-2.2.27/srclib/apr<span class="string">':</span></div><div class="line"><span class="string">configure: error: no acceptable C compiler found in $PATH</span></div><div class="line"><span class="string">See `config.log'</span> <span class="keyword">for</span> more details</div><div class="line">configure failed <span class="keyword">for</span> srclib/apr</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;不幸的是，一开始就报错了，因为没有gcc编译器，需要先安装一下。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># yum install -y gcc</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;由于gcc依赖的包很多，所以安装时间会长一些。安装完后，再继续上面的步骤。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># ./configure --prefix=/usr/local/apache2</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;验证这一步是否成功的命令是：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># echo $?</span></div><div class="line">0</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;返回值如果是 “0” 则执行成功，否则就是没有成功。此时就成功生成 Makefile 了。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># ls -l Makefile</span></div><div class="line">-rw-r--r-- 1 root root 8954 5月  13 12:02 Makefile</div></pre></td></tr></table></figure>
<h3 id="4-进行编译"><a href="#4-进行编译" class="headerlink" title="4.进行编译"></a>4.进行编译</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># make</span></div><div class="line">-bash: make: <span class="built_in">command</span> not found</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;又发生错误了，提示 “make” 命令没有发现，解决办法是安装make工具。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># yum install -y make</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;继续make</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># make</span></div><div class="line">Making all <span class="keyword">in</span> srclib</div><div class="line">make[1]: Entering directory `/usr/<span class="built_in">local</span>/src/httpd-2.2.27/srclib<span class="string">'</span></div><div class="line"><span class="string">Making all in apr</span></div><div class="line"><span class="string">make[2]: Entering directory `/usr/local/src/httpd-2.2.27/srclib/apr'</span></div><div class="line">make[3]: Entering directory `/usr/<span class="built_in">local</span>/src/httpd-2.2.27/srclib/apr<span class="string">'</span></div><div class="line"><span class="string">/bin/sh /usr/local/src/httpd-2.2.27/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I./include -I/usr/local/src/httpd-2.2.27/srclib/apr/include/arch/unix -I./include/arch/unix -I/usr/local/src/httpd-2.2.27/srclib/apr/include/arch/unix -I/usr/local/src/httpd-2.2.27/srclib/apr/include  -o passwd/apr_getpass.lo -c passwd/apr_getpass.c &amp;&amp; touch passwd/apr_getpass.lo</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编译的时候，就会出现类似这么多乱七八糟的信息，编译的时间比较长，CPU使用率会很高，这是因为CPU高速计算，编译完后，再使用 echo $? 验证一下是否正常成功。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># echo $?</span></div><div class="line">0</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果是0的话，就可以执行最后一步了。</p>
<h3 id="5-安装"><a href="#5-安装" class="headerlink" title="5.安装"></a>5.安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># make install</span></div><div class="line">Making install <span class="keyword">in</span> srclib</div><div class="line">make[1]: Entering directory `/usr/<span class="built_in">local</span>/src/httpd-2.2.27/srclib<span class="string">'</span></div><div class="line"><span class="string">Making install in apr</span></div><div class="line"><span class="string">make[2]: Entering directory `/usr/local/src/httpd-2.2.27/srclib/apr'</span></div><div class="line">make[3]: Entering directory `/usr/<span class="built_in">local</span>/src/httpd-2.2.27/srclib/apr<span class="string">'</span></div><div class="line"><span class="string">make[3]: Nothing to be done for `local-all'</span>.</div><div class="line">make[3]: Leaving directory `/usr/<span class="built_in">local</span>/src/httpd-2.2.27/srclib/apr<span class="string">'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;当然也可以使用 echo $? 看看有没有正确安装，执行完这一步，则会在 “/usr/local/apache2” 目录下增加了很多目录。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@localhost httpd-2.2.27]<span class="comment"># ls /usr/local/apache2/</span></div><div class="line">bin    cgi-bin  error   icons    lib   man     modules</div><div class="line">build  conf     htdocs  include  logs  manual</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;到此，apache源码的安装就完成了</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Linux/" rel="tag"># Linux</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/03/1. Linux 基础/30. vim编辑器里面一些不为人知的操作/" rel="next" title="vim编辑器里面一些不为人知的操作">
                <i class="fa fa-chevron-left"></i> vim编辑器里面一些不为人知的操作
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/03/1. Linux 基础/59. iptables中的DNAT、SNAT和MASQUERADE/" rel="prev" title="iptables中的DNAT、SNAT、和MASQUERADE">
                iptables中的DNAT、SNAT、和MASQUERADE <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/0.png"
               alt="失落的乐章" />
          <p class="site-author-name" itemprop="name">失落的乐章</p>
           
              <p class="site-description motion-element" itemprop="description">失落的乐章的Blog</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">627</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hcldirgit" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装一个源码包，通常需要三个步骤："><span class="nav-number">1.</span> <span class="nav-text">安装一个源码包，通常需要三个步骤：</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#configure"><span class="nav-number">1.1.</span> <span class="nav-text">./configure</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#make"><span class="nav-number">1.2.</span> <span class="nav-text">make</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#make-install"><span class="nav-number">1.3.</span> <span class="nav-text">make install</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Apache源码安装实例"><span class="nav-number">2.</span> <span class="nav-text">Apache源码安装实例</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-下载一个源码包"><span class="nav-number">2.1.</span> <span class="nav-text">1.下载一个源码包</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-解压源码包"><span class="nav-number">2.2.</span> <span class="nav-text">2.解压源码包</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-配置相关的选项，并生成Makefile"><span class="nav-number">2.3.</span> <span class="nav-text">3.配置相关的选项，并生成Makefile</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-进行编译"><span class="nav-number">2.4.</span> <span class="nav-text">4.进行编译</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-安装"><span class="nav-number">2.5.</span> <span class="nav-text">5.安装</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">失落的乐章</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
